//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    music:[],
  },
  onLoad() {
    wx.request({
      url: 'https://music.aityp.com/program/recommend?limit=30',
      data: {},
      header: { 'content-type': 'application/json' },
      method: 'GET',
      dataType: 'json',
      responseType: 'text',
      success: (res) => {
        var musics=res.data.programs;
        var music=[];
        console.log(musics)
        musics.forEach(item=>{
          var obj={};
          obj.picUrl=item.coverUrl;
          obj.name=item.mainSong.name;
          obj.author=item.mainSong.artists[0].name;
          obj.play=item.listenerCount;
          obj.like=item.likedCount;
          music.push(obj);
        }),
        this.setData({
          music,
        })
      },

    });
  }
})
